home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / libs / unixlib.lha / unix / src / onbreak.c < prev    next >
C/C++ Source or Header  |  1996-10-13  |  518b  |  32 lines

  1. #include "amiga.h"
  2. #include "signals.h"
  3.  
  4. static int brk(void);
  5. int (*_break_func)(void) = brk;
  6.  
  7. static int brk(void)
  8. {
  9.     void (*sigint_func)(int);
  10.  
  11.     sigint_func = _sig_handlers[SIGINT];
  12.  
  13.     switch ((int)sigint_func) {
  14.     case (int)SIG_DFL:
  15.         return 1;
  16.     case (int)SIG_IGN:
  17.         return 0;
  18.     default:
  19.         sigint_func(SIGINT);
  20.     }
  21.     return 0;
  22. }
  23.  
  24. int onbreak(int (*func)(void))
  25. {
  26.     if (func == NULL)
  27.     _break_func = brk;
  28.     else
  29.     _break_func = func;
  30.     return 0;    /* to be compatible with SAS/C onbreak() */
  31. }
  32.